﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Yaml.Presentation {
    /// <summary>
    /// A position in the character stream
    /// </summary>
    public class Mark {
        int characterIndex;
        int line;
        int column;

        /// <summary>
        /// Create a new mark.
        /// </summary>
        public Mark(int characterIndex, int line, int column) {
            this.characterIndex = characterIndex;
            this.line = line;
            this.column = column;
        }

        /// <summary>
        /// The index in character of this mark
        /// </summary>
        public int CharacterIndex {
            get { return this.characterIndex; }
        }

        /// <summary>
        /// The line of this mark, starting from 0.
        /// </summary>
        public int Line {
            get { return this.line; }
        }

        /// <summary>
        /// The column of this mark, starting from 0.
        /// </summary>
        public int Column {
            get { return this.column; }
        }

        /// <summary>
        /// Generate a human-friendly string representation of this mark.
        /// </summary>
        /// <returns></returns>
        public override String ToString() {
            return "{" + characterIndex + ":" + line + "," + column + "}";
        }
    }
}
